#include<iostream>
#include<cstdio>
#include<cmath>
#include<string>
#include<cstring>
#include<algorithm>
using namespace std;
int bz[222222];
int a[222222];
int aa[222222];
int n,i,j,t,t1,t2,s1;
char s[222222];
char ss[222222];
void dfs(int nn,int x,int y)
{
	if((x==t1)&&(y==t2))
	{
		for(int i=n;i>=1;i--)
		{
			if(a[x]==aa[i]) 
			{
				x++;
				nn++;
				ss[nn]='L';
			}
			else
				if(a[y]==aa[i])
				{
					y--;
					nn++;
					ss[nn]='R';
				}
				else
					break;
		}
		if(nn!=2*n) return;
		else
		{
			bool bz1=false;
			for(int i=1;i<=2*n;i++)
			{
				if(s[i]>ss[i])
				{
					bz1=true;
					break;
				}
			}
			if(bz1==true)
			{
				for(int i=1;i<=2*n;i++)
				{
					s[i]=ss[i];
				}
			}
		}
	}
	else
	if((x!=t1)&&(y==t2))
	{
		nn++;
		aa[nn]=a[x];
		ss[nn]='L';
		x++;
		dfs(nn,x,y);
	}
	else
	if((x==t1)&&(y!=t2))
	{
		nn++;
		aa[nn]=a[y];
		ss[nn]='R';
		y--;
		dfs(nn,x,y);
	}
	else
	{
		nn++;
		aa[nn]=a[y];
		ss[nn]='R';
		y--;
		dfs(nn,x,y);
		y++;
		aa[nn]=a[x];
		ss[nn]='L';
		x++;
		dfs(nn,x,y);
	}
}
int main()
{
	freopen("palin.in","r",stdin);
	freopen("palin.out","w",stdout);
	scanf("%d",&t);
	s[1]='Z';
	for(i=1;i<=t;i++)
	{
		scanf("%d",&n);
		memset(bz,0,sizeof(bz));
		for(j=1;j<=2*n;j++)
		{
			scanf("%d",&a[j]);
		}
		t1=1,t2=n;
		s1=0;
		for(j=t1;j<=t2;j++)
		{
			if(bz[a[j]]==0) s1++;
			bz[a[j]]++;
		}
		if(s1==n) dfs(0,1,2*n);
		for(j=1;j<=n;j++)
		{
			t1++,t2++;
			bz[a[t1-1]]--;
			if(bz[a[t1-1]]==0) s1--;
			if(bz[a[t2]]==0) s1++;
			bz[a[t2]]++;
			if(s1==n) dfs(0,1,2*n);
		}
		if(s[1]=='Z') printf("-1\n");
		else
		{
			for(j=1;j<=2*n;j++)
			{
				cout<<s[j];
				s[j]='Z';
			}
			printf("\n");
		}
		
	}
	fclose(stdin);
	fclose(stdout);
}
